package com.sky.service.impl;

import com.sky.constant.MessageConstant;
import com.sky.entity.Category;
import com.sky.exception.BaseException;
import com.sky.mapper.UserCategoryServiceMapper;
import com.sky.service.UserCategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zcf
 */
@Service
public class UserCategoryServiceImpl implements UserCategoryService {

    @Resource
    private UserCategoryServiceMapper userCategoryServiceMapper;

    // 查询所有分类
    @Override
    public List<Category> list() {
        List<Category> list = userCategoryServiceMapper.list();
        if(list == null){
            throw new BaseException(MessageConstant.CATEGORY_NOT_FOUND);
        }
        return list;
    }
}
